Return to start page

Systems/Character/Struct Abstract Character System.j

Code

		
1			library AStructSystemsCharacterAbstractCharacterSystem
2
3 private interface AAbstractCharacterSystemInterface
4 public method enable takes nothing returns nothing
5 public method disable takes nothing returns nothing
6 public method changedUnit takes nothing returns nothing
7 //static method create takes ACharacter character returns ACharacterSystemInterface
8 endinterface
9
10 struct AAbstractCharacterSystem extends AAbstractCharacterSystemInterface
11 //dynamic members
12 private boolean m_enableAgain
13 //start members
14 private ACharacter m_character
15 //members
16 private boolean m_isEnabled
17
18 //start members
19
20 public method character takes nothing returns ACharacter
21 return this.m_character
22 endmethod
23
24 //members
25
26 public method isEnabled takes nothing returns boolean
27 return this.m_isEnabled
28 endmethod
29
30 public method setEnableAgain takes boolean enableAgain returns nothing
31 set this.m_enableAgain = enableAgain
32 endmethod
33
34 public method enableAgain takes nothing returns boolean
35 return this.m_enableAgain
36 endmethod
37
38 //convenience methods
39
40 public method user takes nothing returns player
41 return this.m_character.user()
42 endmethod
43
44 public method unit takes nothing returns unit
45 return this.m_character.unit()
46 endmethod
47
48 //methods
49
50 public stub method enable takes nothing returns nothing
51 set this.m_isEnabled = true
52 endmethod
53
54 public stub method disable takes nothing returns nothing
55 set this.m_isEnabled = false
56 endmethod
57
58 /// @todo Friend relation to @struct ACharacter, do not use!
59 /// Is called when character unit is changed. Change all registered specific unit events.
60 public stub method changedUnit takes nothing returns nothing
61 endmethod
62
63 public static method create takes ACharacter character returns thistype
64 local thistype this = thistype.allocate()
65 //dynamic members
66 set this.m_enableAgain = true
67 //start members
68 set this.m_character = character
69 //members
70 set this.m_isEnabled = true
71
72 return this
73 endmethod
74 endstruct
75
76 endlibrary